package com.beerandjesus.sportofkings.handicapper.strategy.brisnet.singlefile;

import com.beerandjesus.sportofkings.handicapper.model.HorseAnalysisResultImpl;
import com.beerandjesus.sportofkings.handicapper.model.MixedNumeral;
import com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse;
import com.beerandjesus.sportofkings.handicapper.strategy.RacingCalculator;
import org.apache.commons.lang.StringUtils;

import java.math.BigDecimal;

public class MorningLineOddsResolver {
    protected RacingCalculator calc = new RacingCalculator();

    public MorningLineOddsResolver() {
    }

    protected void resolveMorningLineOdds(HorseAnalysisResultImpl result, Horse h) {
        MixedNumeral mlOdds = null;
        if (!StringUtils.isEmpty(h.getMorningLineOdds())) {
            mlOdds = calc.toFraction(new BigDecimal(h.getMorningLineOdds()));
        }
        result.setMorningLine(mlOdds);
    }
}